package com.example.observerdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.example.observerdemo.observer.ObserverHolder;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class StaffManageActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_staff_manage);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.btn_add, R.id.btn_delete})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_add:
                ObserverHolder.getInstance().notifyObservers("添加员工",ObserverHolder.STAFF_ADD);
                break;
            case R.id.btn_delete:
                ObserverHolder.getInstance().notifyObservers("删除员工",ObserverHolder.STAFF_DELETE);
                break;
        }
    }
}
